<?php
require "config.php"; 
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<meta http-equiv="content-type" content="text/html" />
	<meta name="author" content="thedaigiapro@bitvn.org" />

	<title>Xem tin</title>
</head>

<body>
<div style="width: 980px; margin: auto;">
<?php
$id = (isset($_GET['id'])) ? $_GET['id'] : '0';
if($id ==0){
    $sql = "SELECT * FROM tbl_news"; 
    $rs = mysql_query($sql) or die (mysql_error());
     
    while ($row = mysql_fetch_array($rs)) {     
        echo '<h2><a href="xemtin.php?id='.$row['idTin'].'">'.$row['TieuDe'].'</a></h2><br/>';
        echo '<p><img src="'.$row['urlHinh'].'"/><strong>'.$row['TomTat'].'</strong></p><br/>';  
    }
} else{
    $sql = "SELECT * FROM tbl_news where idTin ='{$id}'"; 
    $rs = mysql_query($sql) or die (mysql_error());     
    while ($row = mysql_fetch_array($rs)) {     
        echo '<h2><a href="xemtin.php?id='.$row['idTin'].'">'.$row['TieuDe'].'</a></h2><br/>';
        echo '<strong>'.$row['TomTat'].'</strong><br/>';
        echo '<div>'.$row['Content'].'</div><br/>';    
    }
}
?>
</div>
</body>
</html>